//项目基本信息
$certusUtils.ajax("getBgCounts",{"proId":proId},function (response) {
    if (response.data>0){
        layer.msg("此项目有变更流程未结束，不能申请新的流程！");
        $("#isCanTj").attr("disabled",true);
        return
    }
});

$certusUtils.ajax("findProDetaiInfo", {
    "proId": proId
}, function (response) {
    var data = response.data.proMap;
    $("#proNo").html(data.pro_no);

    var proType = data.pro_type;
    if (proType == "ZL") {
        $("#proType").html("战略类");
    } else if (proType == "YF") {
        $("#proType").html("研发类");
    } else if (proType == "XS") {
        $("#proType").html("销售类");
    } else if (proType == "BM") {
        $("#proType").html("部门类");
    } else if (proType == "SW") {
        $("#proType").html("事务类");
    } else {
        $("#proType").html("测试类");
    }
    $("#oldUrgency").val(data.purgency);
    if (data.purgency==0){
        $("#urgency").html("一般");
    }else if (data.purgency==1){
        $("#urgency").html("重要");
    }else{
        $("#urgency").html("战略");
    }
    $("#oldImportance").val(data.pimportance);
    if (data.pimportance==0){
        $("#importance").html("不紧急");
    }else{
        $("#importance").html("紧急");
    }
    if (proType == "XS") {
        $("#showVersion").hide();
        $("#cusName").html(data.cus_name);
        $("#oldCusId").val(data.cus_id);
        $("#proArea").html(data.pro_area);
        $("#divineSignDate").html(data.divine_sign_date);
        $("#divineHkDate").html(data.divine_hk_date);
        $("#cusPolicy").html(data.cus_policy);
        $("#competitor").html(data.competitor);
        var isCompare = data.is_compare;
        $("#compare").val(isCompare);
        if (isCompare == 1) {
            $("#isCompare").html("有");
        } else {
            $("#isCompare").html("无");
        }
    } else if (proType == "ZL" || proType == "SW" ||
        proType == "BM") {
        if (proType=="BM"){
            $("#showProDay").hide();
        }
        $("#showCus").hide();
        $("#showCusCkbox").hide();

        $("#showArea").hide();
        $("#showAreaCkbox").hide();

        $("#showCompare").hide();
        $("#showCompareCkbox").hide();

        $("#showSign").hide();
        $("#showSignCkbox").hide();

        $("#showHk").hide();
        $("#showHkCkbox").hide();

        $("#showPolucy").hide();
        $("#showPolucyCkbox").hide();

        $("#showPdLine").hide();
        $("#showPdLineCkbox").hide();

        $("#showCompe").hide();
        $("#showCompeCkbox").hide();

        $("#showVersion").hide();

        $("#divineFinishTime").html(data.dfTime);
    } else {
        $("#showCus").hide();
        $("#showCusCkbox").hide();

        $("#showArea").hide();
        $("#showAreaCkbox").hide();

        $("#showCompare").hide();
        $("#showCompareCkbox").hide();

        $("#showSign").hide();
        $("#showSignCkbox").hide();

        $("#showHk").hide();
        $("#showHkCkbox").hide();

        $("#showPolucy").hide();
        $("#showPolucyCkbox").hide();

        $("#showPdLine").hide();
        $("#showPdLineCkbox").hide();

        $("#showCompe").hide();
        $("#showCompeCkbox").hide();

        $("#divineVersionTime").html(data.dvTime);
    }

    $("#proName").html(data.pro_name);
    var proLv = data.pro_lv;
    $("#proLvFlag").val(proLv);
    if (proLv == 3) {
        $("#proLv").html("高");
    } else if (proLv == 2) {
        $("#proLv").html("中");
    } else {
        $("#proLv").html("低");
    }
    var proState = data.pro_state;
    $("#proStateFlag").val(proState);
    if (proState == 1) {
        $("#proState").html("运行中");
        $("#topState").html('<span class="label label-primary">运行中</span>');
    } else if (proState == 2) {
        $("#proState").html("已关闭");
        $("#topState").html('<span class="label label-danger">已关闭</span>');
    } else if (proState == 3) {
        $("#proState").html("已完结");
        $("#topState").html('<span class="label label-success">已完结</span>');
    } else  if (proState == 4) {
        $("#proState").html("已暂停");
        $("#topState").html('<span class="label label-warning">已暂停</span>');
    }
    $("#clueDesc").html(data.clue_desc);
    $("#proTarget").html(data.pro_target);
    $("#deptName").html(data.deptName);
    $("#oldDeptId").val(data.dept_id);
    $("#oldCompId").val(data.comp_id);
    $("#mgName").html(data.mgName);
    $("#delName").html(data.delName);
    $("#pduName").html(data.pduName);
    $("#startTime").html(data.startTime);
    $("#startDay").val(data.startTime);
    $("#endTime").html(data.endTime);
    $("#pdLine").html(response.data.deptNames);
    $("#pdLineCodes").val(data.pd_line_codes);

    $("#showXsMoney").hide();
    $("#shoYsMoney").hide();
    $("#showXsBudget").hide();
    $("#showYsBudget").hide();
    var budgetList = response.data.budgetMap;
    for (var i=0;i<budgetList.length;i++){
        if (budgetList[i].buget_type=="预计销售额"){
            $("#showXsMoney").show();
            $("#showXsBudget").show();
            $("#xsBudget").html(budgetList[i].buget);
        }else if (budgetList[i].buget_type=="客户预算"){
            $("#shoYsMoney").show();
            $("#showYsBudget").show();
            $("#ysBudget").html(budgetList[i].buget);
        }
    }

    //判断是否有项目、产品、交付、销售经理
    $("#hasXmjl").hide();
    $("#hasCpjl").hide();
    $("#hasJfjl").hide();
    $("#hasXsjl").hide();

    $("#pXmjl").hide();
    $("#pCpjl").hide();
    $("#pXsjl").hide();
    $("#pJfjl").hide();

    if (data.code>=5&&data.code<=9){
        $("#pXmjl").hide();
        $("#pCpjl").hide();
        $("#pXsjl").hide();
        $("#pJfjl").hide();
    }

    var memberList = response.data.mebMap;
    for (var i = 0; i < memberList.length; i++) {
        var codes = memberList[i].proRoleCode.split(",");
        for (var j=0;j<codes.length;j++){
            //indexOf 大小写敏感
            if (codes[j].indexOf("XSFZR")>-1) {
                $("#pxsUser").html(memberList[i].userName);
                $("#pxsUserId").val(memberList[i].userId);
            }
            if (codes[j].indexOf("XMJL")>-1) {
                $certusUtils.ajax("findSpUserList",{},function (response) {
                    var nhlTeams = [];
                    var data = response.data;
                    for (var i=0;i<data.length;i++){
                        var arr={};
                        arr.name=data[i].userName+"["+data[i].positonName+"]";
                        arr.id = data[i].userId;
                        nhlTeams.push(arr);
                    }
                    //自动补全
                    var nhl = $.map(nhlTeams, function (obj) {
                        return {
                            value: obj.name,
                            data: { category: obj.id }
                        };
                    });
                    //项目经理
                    $('#proUser').devbridgeAutocomplete({
                        lookup: nhl,
                        minChars: 1,
                        onSelect: function (suggestion) {
                            $("#proUserId").val(suggestion.data.category);
                        },
                        showNoSuggestionNotice: true,
                        noSuggestionNotice: 'Sorry, no matching results'
                    });
                });

                $("#hasXmjl").show();
                $("#pXmjl").show();
                $("#pxmUser").html(memberList[i].userName);
                $("#pxmUserId").val(memberList[i].userId);
            }
            if (codes[j].indexOf("CPJL")>-1) {
                $certusUtils.ajax("findSpUserList",{},function (response) {
                    var nhlTeams = [];
                    var data = response.data;
                    for (var i=0;i<data.length;i++){
                        var arr={};
                        arr.name=data[i].userName+"["+data[i].positonName+"]";
                        arr.id = data[i].userId;
                        nhlTeams.push(arr);
                    }
                    //自动补全
                    var nhl = $.map(nhlTeams, function (obj) {
                        return {
                            value: obj.name,
                            data: { category: obj.id }
                        };
                    });
                    //产品经理
                    $('#cpUser').devbridgeAutocomplete({
                        lookup: nhl,
                        minChars: 1,
                        onSelect: function (suggestion) {
                            $("#cpUserId").val(suggestion.data.category);
                        },
                        showNoSuggestionNotice: true,
                        noSuggestionNotice: 'Sorry, no matching results'
                    });
                });
                $("#hasCpjl").show();
                $("#pCpjl").show();
                $("#pcpUser").html(memberList[i].userName);
                $("#pcpUserId").val(memberList[i].userId);
            }
            if (codes[j].indexOf("JFJL")>-1) {
                $certusUtils.ajax("findSpUserList",{},function (response) {
                    var nhlTeams = [];
                    var data = response.data;
                    for (var i=0;i<data.length;i++){
                        var arr={};
                        arr.name=data[i].userName+"["+data[i].positonName+"]";
                        arr.id = data[i].userId;
                        nhlTeams.push(arr);
                    }
                    //自动补全
                    var nhl = $.map(nhlTeams, function (obj) {
                        return {
                            value: obj.name,
                            data: { category: obj.id }
                        };
                    });
                    //交付经理
                    $('#jfUser').devbridgeAutocomplete({
                        lookup: nhl,
                        minChars: 1,
                        onSelect: function (suggestion) {
                            $("#jfUserId").val(suggestion.data.category);
                        },
                        showNoSuggestionNotice: true,
                        noSuggestionNotice: 'Sorry, no matching results'
                    });
                });
                $("#hasJfjl").show();
                $("#pJfjl").show();
                $("#pjfUser").html(memberList[i].userName);
                $("#pjfUserId").val(memberList[i].userName);
            }
            if (codes[j].indexOf("XSJL")>-1) {
                $certusUtils.ajax("findSpUserList",{},function (response) {
                    var nhlTeams = [];
                    var data = response.data;
                    for (var i=0;i<data.length;i++){
                        var arr={};
                        arr.name=data[i].userName+"["+data[i].positonName+"]";
                        arr.id = data[i].userId;
                        nhlTeams.push(arr);
                    }
                    //自动补全
                    var nhl = $.map(nhlTeams, function (obj) {
                        return {
                            value: obj.name,
                            data: { category: obj.id }
                        };
                    });
                    //销售经理
                    $('#selUser').devbridgeAutocomplete({
                        lookup: nhl,
                        minChars: 1,
                        onSelect: function (suggestion) {
                            $("#selUserId").val(suggestion.data.category);
                        },
                        showNoSuggestionNotice: true,
                        noSuggestionNotice: 'Sorry, no matching results'
                    });
                });
                $("#hasXsjl").show();
                $("#pXsjl").show();
                $("#pselUser").html(memberList[i].userName);
                $("#pselUserId").val(memberList[i].userId);
            }
        }
    }
});
$certusUtils.ajax("getPdlines",{},function (response) {
    var pdLineDate = response.data;
    var html=``;
    for (var i=0;i<pdLineDate.length;i++){
        var deptList = pdLineDate[i].deptList;
        html+=`<div>`;
        for (var j=0;j<deptList.length;j++){
            html+=`<div><div class="checkbox"><label>
                        <input type="checkbox" onclick="ckIsN(this.value)" value="`+deptList[j].departmentCode+`">
                <span>`+deptList[j].departmentName+`</span></label></div></div>`;
        }
        html+=`</div>`;
    }
    $("#productLine").append(html);
});

function ckIsN(value) {
    if (value=="N"){
        $("#pdLineCkbox").find("input[type='checkbox']").each(function (i,n) {
            if ($(n).val()!="N"){
                $(n).attr("checked",false);
            }
        });
    }else{
        $("#pdLineCkbox").find("input[type='checkbox']").each(function (i,n) {
            if ($(n).val()=="N"){
                $(n).attr("checked",false);
            }
        });
    }
}

$certusUtils.ajax("companyListByViewCode", {}, function (response) {
    var companyList = JSON.parse(response.data);
    var selectid = document.getElementById("company");
    $(selectid).empty();
    selectid.options.add(new Option("请选择",""));
    for (var i=0;i<companyList.length;i++){
        selectid.options.add(new Option(companyList[i].company, companyList[i].companyId));
    }
    $(selectid).val("STSJT");
    getDept("STSJT");
    getArea("STSJT");
});

this.getDept = function (companyCode) {
    if (companyCode==undefined||companyCode==null||companyCode==""){
        companyCode = $("#company").val();
    }
    if (projectType == "XS") {
        $certusUtils.ajax("xsDeptList", {
            companyCode: companyCode
        }, function (response) {
            var companyList = response.data;
            var selectid = document.getElementById("department");
            $(selectid).empty();
            selectid.options.add(new Option("请选择",""));
            for (var i=0;i<companyList.length;i++){
                selectid.options.add(new Option(companyList[i].departmentName, companyList[i].departmentCode));
            }
        });
    } else {
        $certusUtils.ajax("deptedList", {
            companyCode: companyCode
        }, function (response) {
            var companyList = JSON.parse(response.data);
            var selectid = document.getElementById("department");
            $(selectid).empty();
            selectid.options.add(new Option("请选择",""));
            for (var i=0;i<companyList.length;i++){
                selectid.options.add(new Option(companyList[i].departmentName, companyList[i].departmentCode));
            }
        });
    }
};
this.getArea = function (companyCode) {
    if (companyCode==undefined||companyCode==null||companyCode==""){
        companyCode = $("#company").val();
    }
    $certusUtils.ajax("findRegionList", {
        "compCode": companyCode
    }, function (response) {
        var areaList = response.data;
        var selectid = document.getElementById("area");
        $(selectid).empty();
        selectid.options.add(new Option("请选择",""));
        for (var i=0;i<areaList.length;i++){
            selectid.options.add(new Option(areaList[i].city, areaList[i].city));
        }
    });
};

$certusUtils.ajax("findComList",{},function (response) {
    var nhlTeams = [];
    var data = response.data;
    for (var i=0;i<data.length;i++){
        var arr={};
        arr.name=data[i].comName+"（"+data[i].comShortName+"）-----"+data[i].userName;
        arr.id = data[i].id;
        nhlTeams.push(arr);
    }
    //自动补全
    var nhl = $.map(nhlTeams, function (obj) {
        return {
            value: obj.name,
            data: { category: obj.id }
        };
    });
    $('#cus').devbridgeAutocomplete({
        lookup: nhl,
        minChars: 1,
        onSelect: function (suggestion) {
            $("#cusId").val(suggestion.data.category);
            var cusName = $("#cus").val().split("-----");
            // $("#proNameCk").val(cusName[0]);
        },
        showNoSuggestionNotice: true,
        noSuggestionNotice: 'Sorry, no matching results'
    });
});

$certusUtils.ajax("findSpUserList",{},function (response) {
    var nhlTeams = [];
    var data = response.data;
    for (var i=0;i<data.length;i++){
        var arr={};
        arr.name=data[i].userName+"["+data[i].positonName+"]";
        arr.id = data[i].userId;
        nhlTeams.push(arr);
    }
    //自动补全
    var nhl = $.map(nhlTeams, function (obj) {
        return {
            value: obj.name,
            data: { category: obj.id }
        };
    });
    //产品经理
    $('#xsUser').devbridgeAutocomplete({
        lookup: nhl,
        minChars: 1,
        onSelect: function (suggestion) {
            $("#xsUserId").val(suggestion.data.category);
        },
        showNoSuggestionNotice: true,
        noSuggestionNotice: 'Sorry, no matching results'
    });
});

//所属公司change事件
function findDept() {
    getDept($("#company").val());
    getArea($("#company").val());
}

/////-----------------end
// 产品线
var lineArry = [];
// 产品线选择
function lineCheck(value) {
  if (value === 'N') {
    var index = lineArry.indexOf('N');
    if (index === -1) {
      $("#productLine input[type='checkbox']").prop('checked', false);
      $('#lineNan').prop('checked', true);
      lineArry = ['N'];
    } else {
      $('#lineNan').prop('checked', false);
      lineArry = [];
    }
  } else {
    var none = lineArry.indexOf('N');
    var repeat = lineArry.indexOf(value);
    if (none === -1 && repeat === -1) {
      lineArry.push(value)
    }
    if (none === -1 && repeat !== -1) {
      var index = lineArry.indexOf(value);
      lineArry.splice(index, 1);
    }
    if (none !== -1 && repeat === -1) {
      $('#lineNan').prop('checked', false);
      lineArry.splice(none, 1);
      lineArry.push(value)
    }
    if (none !== -1 && repeat !== -1) {
      $('#lineNan').prop('checked', false);
      lineArry.splice(none, 1);
      var index = lineArry.indexOf(value);
      lineArry.splice(index, 1);
    }
  }
  return lineArry;
}

// 勾选展示
function shidList(type) {
    //按照 li顺序显示，如果删除字段需要重新编号
  var status = $("#" + type).prop('checked');
  var number = type.substring(5, type.length);
  if (status) {
    $('#changeList li:nth-child(' + number + ')').show();
  } else {
    $('#changeList li:nth-child(' + number + ')').hide();
  }
}

// 项目变更信息
function changeProinfo() {
    var data = {};
    // 项目
    var isCz = false;
    if ($("#type-1").prop('checked')) {
      var project = $("#proNameCk").val();
      if (project === "" || project === null || project === undefined) {
          layer.msg("项目名称不能为空！");
          return;
      }else{
          $certusUtils.ajax("isHasProName", { "proName": project }, function (response) {
              if (response.data == true) {
                  layer.msg("项目名称已存在！", { "time": 1000 });
                  isCz = true;
                  return;
              } else {
                  data.ckproName = project;
                  data.oldProName = $("#proName").html();
              }
          });
      }
    }

    setTimeout(function () {
        if (!isCz){
            // 线索负责人
            if ($("#type-2").prop('checked')) {
                var xsUserId = $("#xsUserId").val();
                if (xsUserId === "" || xsUserId === null || xsUserId === undefined) {
                    layer.msg("线索负责人不能为空！");
                    return;
                }
                data.xsUserId = xsUserId;
                var xsUserName = $("#xsUser").val().split("(")[0];
                data.xsUser = xsUserName;
                data.oldXsUser = $("#pxsUser").html();
                data.oldXsUserId = $("#pxsUserId").val();
            }
            // 销售经理
            // if ($("#type-3").prop('checked')) {
            //     var selUserId = $("#selUserId").val();
            //     if (selUserId === "" || selUserId === null || selUserId === undefined) {
            //         layer.msg("销售经理不能为空！");
            //         return;
            //     }
            //     data.selUserId = selUserId;
            //     data.selUser = $("#selUser").val().split("(")[0];
            //     data.pselUserId = $("#pselUserId").val();
            //     data.pselUser = $("#pselUser").html();
            // }
            // 项目经理
            if ($("#type-3").prop('checked')) {
                var proUserId = $("#proUserId").val();
                if (proUserId === "" || proUserId === null || proUserId === undefined) {
                    layer.msg("项目经理不能为空！");
                    return;
                }
                data.proUserId = proUserId;
                data.proUser = $("#proUser").val().split("(")[0];
                data.oldXmUserId = $("#pxmUserId").val();
                data.oldXmUser = $("#pxmUser").html();
            }
            // 交付经理
            // if ($("#type-5").prop('checked')) {
            //     var jfUserId = $("#jfUserId").val();
            //     if (jfUserId === "" || jfUserId === null || jfUserId === undefined) {
            //         layer.msg("交付经理不能为空！");
            //         return;
            //     }
            //     data.jfUserId = jfUserId;
            //     data.jfUser = $("#jfUser").val().split("(")[0];
            //     data.oldJfUser = $("#pjfUser").html();
            //     data.oldJfUserId = $("#pjfUserId").val();
            // }
            // if ($("#type-6").prop('checked')) {
            //     // 产品经理
            //     var cpUserId = $("#cpUserId").val();
            //     if (cpUserId === "" || cpUserId === null || cpUserId === undefined) {
            //         layer.msg("产品经理不能为空！");
            //         return;
            //     }
            //     data.cpUserId = cpUserId;
            //     data.cpUser = $("#cpUser").val().split("(")[0];
            //     data.oldCpUserId = $("#pcpUserId").val();
            //     data.oldCpUser =  $("#pcpUser").html();
            // }

            if ($("#type-4").prop('checked')) {
                // 状态
                var status = $("#status").val();
                if (status === "" || status === null || status === undefined) {
                    layer.msg("项目状态不能为空！");
                    return;
                }
                data.proStatus = status;
                data.oldProState = $("#proStateFlag").val();
            }
            // 优先级
            // if ($("#type-8").prop('checked')) {
            //     var priority = $("#priority").val();
            //     if (priority === "" || priority === null || priority === undefined) {
            //         layer.msg("项目优先级不能为空！");
            //         return;
            //     }
            //     data.proLv = priority;
            //     data.oldProLv = $("#proLvFlag").val();
            // }

            // if ($("#type-9").prop('checked')) {
            //     // 紧急性
            //     var urgent = $("#urgent").val();
            //     if (urgent === "" || urgent === null || urgent === undefined) {
            //         layer.msg("项目紧急性不能为空！");
            //         return;
            //     }
            //     data.urgency = urgent;
            //     data.oldUrgency = $("#oldUrgency").val();
            // }

            // 重要性
            // if ($("#type-10").prop('checked')) {
            //     var importance = $("#importance1").val();
            //     if (importance === "" || importance === null || importance === undefined) {
            //         layer.msg("项目重要性不能为空！");
            //         return;
            //     }
            //     data.importance = importance;
            //     data.oldImportance = $("#oldImportance").val();
            // }

            // 预签单日期
            // if ($("#type-11").prop('checked')) {
            //     var signDay = $("#signDay").val();
            //     if (signDay === "" || signDay === null || signDay === undefined) {
            //         layer.msg("预签单日期不能为空！");
            //         return;
            //     }
            //     data.signDay = signDay;
            //     data.oldSignDay = $("#divineSignDate").html();
            // }
            // 预回款日期
            // if ($("#type-12").prop('checked')) {
            //     var blankDay = $("#blankDay").val();
            //     if (blankDay === "" || blankDay === null || blankDay === undefined) {
            //         layer.msg("预回款日期不能为空！");
            //         return;
            //     }
            //     data.blankDay = blankDay;
            //     data.oldBlankDay = $("#divineHkDate").html();
            // }


            // 项目周期-开始日期
            // 项目周期-结束日期
            if ($("#type-5").prop('checked')) {
                var startDay = $("#startDay").val();
                var finishDay = $("#finishDay").val();
                if (finishDay === "" || finishDay === null || finishDay === undefined) {
                    layer.msg("项目结束日期不能为空！");
                    return;
                }
                if (finishDay < startDay) {
                    layer.msg("项目结束日期不能小于开始日期！");
                    return;
                }
                data.startDay = startDay;
                data.oldStartDay = $("#startTime").html();
                data.finishDay = finishDay;
                data.oldFinishDay = $("#endTime").html();
            }

            // 销售额
            if ($("#type-6").prop('checked')) {
                var sales = $("#sales").val();
                if (sales === "" || sales === null || sales === undefined) {
                    layer.msg("销售额不能为空！");
                    return;
                }
                data.sales = sales;
                data.oldSales = $("#xsBudget").html();
            }

            // 客户预算
            // if ($("#type-15").prop('checked')) {
            //     var budget = $("#budget").val();
            //     if (budget === "" || budget === null || budget === undefined) {
            //         layer.msg("客户预算不能为空！");
            //         return;
            //     }
            //     data.budget = budget;
            //     var cusName = $("#ysBudget").html().split("-----");
            //     data.oldBudget = cusName[0];
            // }


            // 公司
            // 部门
            // if ($("#type-16").prop('checked')) {
            //     var company = $("#company").val();
            //     if (company==""){
            //         layer.msg("请选择公司！");
            //         return;
            //     }
            //     var department = $("#department").val();
            //     if (department === "" || department === null || department === undefined || department === "0") {
            //         layer.msg("所属部门不能为空！");
            //         return;
            //     }
            //     data.company = company;
            //     data.department = department;
            //     data.oldDeptName = $("#deptName").html();
            //     data.deptName = $("#department option:selected").text();
            //     data.oldDeptId = $("#oldDeptId").val();
            //     data.oldCompId = $("#oldCompId").val();
            // }
            // 区域
            // if ($("#type-17").prop('checked')) {
            //     var area = $("#area").val();
            //     if (area === "" || area === null || area === undefined || area === "0") {
            //         layer.msg("所属区域不能为空！");
            //         return;
            //     }
            //     data.area = area;
            //     data.oldProArea = $("#proArea").html();
            // }
            if ($("#type-7").prop('checked')) {
                // 客户
                var cusId = $("#cusId").val();
                if (cusId === "" || cusId === null || cusId === undefined) {
                    layer.msg("客户名称不能为空！");
                    return;
                }

                var cusName = $("#cus").val().split("-----");
                data.cusName = cusName[0];
                data.cusId = cusId;
                data.oldCusId = $("#oldCusId").val();
                data.oldCusName = $("#cusName").html();
            }

            // 产品线
            // if ($("#type-19").prop('checked')) {
            //     var pdLineCodes = "";
            //     var pdLineNames = "";
            //     $("#pdLineCkbox").find("input[type='checkbox']:checked").each(function (i,n) {
            //         if (i==0){
            //             pdLineCodes+=$(n).val();
            //             pdLineNames+=$($(n).parent().find("span")).html();
            //         }else {
            //             pdLineCodes+=","+$(n).val();
            //             pdLineNames+=","+$($(n).parent().find("span")).html();
            //         }
            //     });
            //     if (pdLineCodes==""){
            //         layer.msg("至少选择一个产品线",{time:1000});
            //         return;
            //     }
            //     data.pdLineCodes = pdLineCodes;
            //     data.pdLineNames = pdLineNames;
            //     data.oldPdLineNames = $("#pdLine").html();
            //     data.oldPdLineCodes = $("#pdLineCodes").val();
            // }

            // if ($("#type-20").prop('checked')) {
            //     // 是否测试
            //     var isCompare = $("#isCompareCk").val();
            //     if (isCompare === "" || isCompare === null || isCompare === undefined) {
            //         layer.msg("预计比拼类测试不能为空！");
            //         return;
            //     }
            //     data.isCompare = isCompare;
            //     data.oldCompare = $("#compare").val();
            // }

            // 线索价值点描述
            // if ($("#type-21").prop('checked')) {
            //     var cluesValue = $("#cluesValue").val();
            //     if (cluesValue === "" || cluesValue === null || cluesValue === undefined) {
            //         layer.msg("线索价值点描述不能为空！");
            //         return;
            //     }
            //     data.cluesValue = cluesValue;
            //     data.oldCluesValue = $("#clueDesc").html();
            // }

            // 竞争信息
            // if ($("#type-22").prop('checked')) {
            //     var competition = $("#competition").val();
            //     if (competition === "" || competition === null || competition === undefined) {
            //         layer.msg("竞争信息不能为空！");
            //         return;
            //     }
            //     data.competition = competition;
            //     data.oldCompetitor = $("#competitor").html()
            // }
            // 客户决策链和关键描述
            // if ($("#type-23").prop('checked')) {
            //     var making = $("#making").val();
            //     if (making === "" || making === null || making === undefined) {
            //         layer.msg("客户决策链和关键描述不能为空！");
            //         return;
            //     }
            //     data.making = making;
            //     data.oldMaking = $("#cusPolicy").html();
            // }

            // 变更说明
            var changeMessage = $("#changeMessage").val();
            if (changeMessage === "" || changeMessage === null || changeMessage === undefined) {
                layer.msg("变更说明不能为空！");
                return;
            }
            data.changeMessage = changeMessage;
            data.proId = proId;
            $certusUtils.ajax('addProModify',{"param":JSON.stringify(data)},function () {
                layer.msg("提交成功!");
                toLoadHtml(27);
            });
        }
    },100);
}
function toBack() {
    toLoadHtml(27);
}

